using System;
using System.Drawing;
using System.Windows.Forms;
using GomokuGame.AI;

namespace GomokuGame
{
    /// <summary>
    /// AI难度选择对话框
    /// </summary>
    public partial class AIDifficultyDialog : Form
    {
        private RadioButton radioBeginner;
        private RadioButton radioIntermediate;
        private RadioButton radioAdvanced;
        private RadioButton radioExpert;
        private Button btnOK;
        private Button btnCancel;
        private Label lblTitle;

        public AIDifficulty SelectedDifficulty { get; private set; }

        public AIDifficultyDialog()
        {
            InitializeComponent();
            Load += AIDifficultyDialog_Load;
        }

        private void InitializeComponent()
        {
            this.lblTitle = new Label();
            this.radioBeginner = new RadioButton();
            this.radioIntermediate = new RadioButton();
            this.radioAdvanced = new RadioButton();
            this.radioExpert = new RadioButton();
            this.btnOK = new Button();
            this.btnCancel = new Button();
            this.SuspendLayout();

            // lblTitle
            this.lblTitle.AutoSize = true;
            this.lblTitle.Font = new Font("微软雅黑", 12F, FontStyle.Bold);
            this.lblTitle.Location = new Point(20, 20);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(120, 21);
            this.lblTitle.Text = "选择AI难度";

            // radioBeginner
            this.radioBeginner.AutoSize = true;
            this.radioBeginner.Font = new Font("微软雅黑", 10F);
            this.radioBeginner.Location = new Point(30, 60);
            this.radioBeginner.Name = "radioBeginner";
            this.radioBeginner.Size = new Size(100, 20);
            this.radioBeginner.Text = "初级";
            this.radioBeginner.UseVisualStyleBackColor = true;
            this.radioBeginner.Checked = true;

            // radioIntermediate
            this.radioIntermediate.AutoSize = true;
            this.radioIntermediate.Font = new Font("微软雅黑", 10F);
            this.radioIntermediate.Location = new Point(30, 90);
            this.radioIntermediate.Name = "radioIntermediate";
            this.radioIntermediate.Size = new Size(100, 20);
            this.radioIntermediate.Text = "中级";
            this.radioIntermediate.UseVisualStyleBackColor = true;

            // radioAdvanced
            this.radioAdvanced.AutoSize = true;
            this.radioAdvanced.Font = new Font("微软雅黑", 10F);
            this.radioAdvanced.Location = new Point(30, 120);
            this.radioAdvanced.Name = "radioAdvanced";
            this.radioAdvanced.Size = new Size(100, 20);
            this.radioAdvanced.Text = "高级";
            this.radioAdvanced.UseVisualStyleBackColor = true;

            // radioExpert
            this.radioExpert.AutoSize = true;
            this.radioExpert.Font = new Font("微软雅黑", 10F);
            this.radioExpert.Location = new Point(30, 150);
            this.radioExpert.Name = "radioExpert";
            this.radioExpert.Size = new Size(100, 20);
            this.radioExpert.Text = "专家";
            this.radioExpert.UseVisualStyleBackColor = true;

            // btnOK
            this.btnOK.DialogResult = DialogResult.OK;
            this.btnOK.Font = new Font("微软雅黑", 9F);
            this.btnOK.Location = new Point(80, 200);
            this.btnOK.Name = "btnOK";
            this.btnOK.Size = new Size(75, 30);
            this.btnOK.Text = "确定";
            this.btnOK.UseVisualStyleBackColor = true;
            this.btnOK.Click += BtnOK_Click;

            // btnCancel
            this.btnCancel.DialogResult = DialogResult.Cancel;
            this.btnCancel.Font = new Font("微软雅黑", 9F);
            this.btnCancel.Location = new Point(170, 200);
            this.btnCancel.Name = "btnCancel";
            this.btnCancel.Size = new Size(75, 30);
            this.btnCancel.Text = "取消";
            this.btnCancel.UseVisualStyleBackColor = true;

            // AIDifficultyDialog
            this.AcceptButton = this.btnOK;
            this.CancelButton = this.btnCancel;
            this.ClientSize = new Size(330, 250);
            this.Controls.AddRange(new Control[] {
                this.lblTitle,
                this.radioBeginner,
                this.radioIntermediate,
                this.radioAdvanced,
                this.radioExpert,
                this.btnOK,
                this.btnCancel
            });
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "AIDifficultyDialog";
            this.StartPosition = FormStartPosition.CenterParent;
            this.Text = "AI难度选择";
            this.ResumeLayout(false);
            this.PerformLayout();
        }

        private void AIDifficultyDialog_Load(object sender, EventArgs e)
        {
            // 设置默认选择
            SelectedDifficulty = AIDifficulty.Intermediate;
        }

        private void BtnOK_Click(object sender, EventArgs e)
        {
            if (radioBeginner.Checked)
            {
                SelectedDifficulty = AIDifficulty.Beginner;
            }
            else if (radioIntermediate.Checked)
            {
                SelectedDifficulty = AIDifficulty.Intermediate;
            }
            else if (radioAdvanced.Checked)
            {
                SelectedDifficulty = AIDifficulty.Advanced;
            }
            else if (radioExpert.Checked)
            {
                SelectedDifficulty = AIDifficulty.Expert;
            }
        }
    }
} 